From: Philip Withnall Date: Thu, 22 Nov 2018 15:03:04 +0000 (+0000) Subject: util: Add a wrapper around getuid() X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~684^2^2~513 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=b82039e324a28e2fe9cf5379b73e6f2e3dc7c86d;p=gnome-shell.git util: Add a wrapper around getuid() So we can use it from JS in an upcoming commit. Signed-off-by: Philip Withnall https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/465 --- diff --git a/src/shell-util.c b/src/shell-util.c index d1a75bc6b..bb2329536 100644 --- a/src/shell-util.c +++ b/src/shell-util.c @@ -638,6 +638,20 @@ shell_util_check_cloexec_fds (void) g_info ("Open fd CLOEXEC check complete"); } +/** + * shell_util_get_uid: + * + * A wrapper around getuid() so that it can be used from JavaScript. This + * function will always succeed. + * + * Returns: the real user ID of the calling process + */ +gint +shell_util_get_uid (void) +{ + return getuid (); +} + static void on_systemd_call_cb (GObject *source, GAsyncResult *res, diff --git a/src/shell-util.h b/src/shell-util.h index 055e88190..aa79f4973 100644 --- a/src/shell-util.h +++ b/src/shell-util.h @@ -78,6 +78,8 @@ gboolean shell_util_has_x11_display_extension (MetaDisplay *display, char *shell_util_get_translated_folder_name (const char *name); +gint shell_util_get_uid (void); + G_END_DECLS #endif /* __SHELL_UTIL_H__ */